package xyz.icxl.kotlion.ext.activity

import android.app.Activity
import androidx.annotation.ColorRes
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity


fun Activity.getContextColor(@ColorRes id: Int): Int {
    return ContextCompat.getColor(applicationContext, id)
}

/**
 * [fragment] 是否已存在[FragmentActivity.getSupportFragmentManager]中
 */
fun FragmentActivity.isExistFragment(fragment: Fragment): Boolean {
    return supportFragmentManager.fragments.find { it.javaClass.name == fragment.javaClass.name } != null
}


